package 密封类;

public abstract sealed class Shape permits Circle,Rectangle,Square{
}
//final表示Circle不能再被继承了
final class Circle extends Shape { }
sealed class Rectangle extends Shape permits TransparentRectangle,FilledRectangle {}

final class TransparentRectangle extends Rectangle {}

final class FilledRectangle extends Rectangle {}
non-sealed class Square extends Shape {} //non-sealed表示可以允许任何类继承